let v = new Vue({
    el:'#main-container',
    data:{
        pageInfo:{
            pageSize:5,
        }
    },
    methods:{
        selectByPage:function (page,pageSize) {

            axios({
                url:`main/user/selectFocusUser/${page}/${pageSize}`,
            }).then(resp => {
                this.pageInfo = resp.data.obj;
            }).catch(error => {
                layer.msg(error.message);
            })
        },
        unfocus:function (user) {
            axios({
                url:'main/user/unfocus',
                method:'post',
                data:user,
            }).then(resp => {
                layer.msg(resp.data.msg);
                if(resp.data.success){
                    this.selectByPage(this.pageInfo.pageNum,this.pageInfo.pageSize);
                }
            }).catch(error => {
                layer.msg(error.message);
            })
        },
        toDetail:function (thisUser) {
            layer.obj = thisUser;
            if(thisUser.isSecret == 0){
                layer.msg("该用户设置了私密信息，不可查看");
            }else{
                layer.open({
                    type: 2,
                    title: '详细信息',
                    area: ['80%', '80%'],
                    content: 'main/user/toDetail',
                    end:() => {

                    }
                })
            }

        },
    },
    created:function () {
        this.selectByPage(1,this.pageInfo.pageSize);
    }
})